﻿using System.Web.Mvc;
using SmallBusinessKit.Interfaces;
using SmallBusinessKit.ViewModels;

namespace SmallBusinessKit.Controllers
{
    public class NewsController : BaseController
    {
        #region Properties

        private readonly INewsDomain _newsDomain;

        #endregion

        #region Methods

        public NewsController(INewsDomain newsDomain)
        {
            _newsDomain = newsDomain;
        }

        [Route("News")]
        public ViewResult Index()
        {
            var viewModel = new NewsViewModel
            {
                News = _newsDomain.GetAllNews()
            };

            return View(viewModel);
        }

        [Route("News/{id:int}")]
        public ViewResult Detail(string id)
        {
            var n = _newsDomain.GetNewsItem(id);

            return View(n);
        }

        #endregion
    }
}